package myplaydog.qf.com.yimixianproject.ui;

import android.os.Bundle;
import android.support.v7.app.AppCompatActivity;
import android.view.View;
import android.widget.TextView;

import myplaydog.qf.com.yimixianproject.R;
import myplaydog.qf.com.yimixianproject.utils.DataCleanManager;

/**
 * 设置
 */
public class SettingActivity extends AppCompatActivity {

    private TextView size;
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_setting);
        size =(TextView)findViewById(R.id.activity_setting_huancun);
        setData();
    }

    private void setData() {
        try {
            String cacheSize = DataCleanManager.getTotalCacheSize(getApplicationContext());
            size.setText(cacheSize);
        } catch (Exception e) {
            e.printStackTrace();
        }
    }
    public void ViewClick(View view){
        if (view!=null){
            switch (view.getId()){
                case R.id.activity_setting_back:
                    finish();
                    break;
                case R.id.activity_setting_clear:
                    DataCleanManager.clearAllCache(this);
                    size.setText("0.00 B");
                    break;
            }
        }
    }
}
